import 'dart:convert';

import 'package:enterprise_v6_app/generated/json/base/json_field.dart';
import 'package:enterprise_v6_app/generated/json/role_menu_tree_entity.g.dart';

export 'package:enterprise_v6_app/generated/json/role_menu_tree_entity.g.dart';

/// 权限菜单实体
@JsonSerializable()
class RoleMenuTreeEntity {
  RoleMenuTreeEntity();

  factory RoleMenuTreeEntity.fromJson(Map<String, dynamic> json) => $RoleMenuTreeEntityFromJson(json);

  ///	子节点
  List<RoleMenuTreeEntity>? children = [];

  ///	组件路径
  String? component = '';

  ///
  RoleMenuTreeMeta? meta = RoleMenuTreeMeta();

  ///
  String? metaStr = '';

  ///	英文菜单名称
  String? name = '';

  ///	菜单路径
  String? path = '';

  ///
  String? redirect = '';

  Map<String, dynamic> toJson() => $RoleMenuTreeEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class RoleMenuTreeMeta {
  RoleMenuTreeMeta();

  factory RoleMenuTreeMeta.fromJson(Map<String, dynamic> json) => $RoleMenuTreeMetaFromJson(json);

  ///
  bool? hidden = false;

  /// 图标
  String? icon = '';

  ///
  bool? primary = false;

  /// 标题
  String? title = '';

  Map<String, dynamic> toJson() => $RoleMenuTreeMetaToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
